package com.example.demo;

/**
 * Copyfright(C),2022-2022,复兴元宇科技有限公司
 * FileName:YZResponse
 * Author:yz
 * Date:2022/3/14 11:49 上午
 * Description:
 * History:
 * <author>  <time> <version> <desc>
 * 作者       时间    版本      描述
 */
public class YZResponse {

    private final static String SUCCESS = "success";

    public static <T> YZResult<T> makeOKRsp() {
        return new YZResult<T>().setCode(YZCode.SUCCESS).setMsg(SUCCESS);
    }

    public static <T> YZResult<T> makeOKRsp(T data) {
        return new YZResult<T>().setCode(YZCode.SUCCESS).setMsg(SUCCESS).setData(data);
    }

    public static <T> YZResult<T> makeErrRsp(String message) {
        return new YZResult<T>().setCode(YZCode.FAIL).setMsg(SUCCESS);
    }

    public static <T> YZResult<T> makeRsp(int code, String msg) {
        return new YZResult<T>().setCode(code).setMsg(msg);
    }

    public static <T> YZResult<T> makeRsp(int code, String msg, T data) {
        return new YZResult<T>().setCode(code).setMsg(msg).setData(data);
    }
}
